package com.craftplay.controller;

import com.craftplay.common.ServerResponse;
import com.craftplay.dao.GlobalAreaMapper;
import com.craftplay.model.GlobalAreaModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/play/area")
public class AreaController {
    @Autowired
    GlobalAreaMapper globalAreaMapper;

    @RequestMapping(method = RequestMethod.GET, value = "/getArea")
    @ResponseBody
    public ServerResponse<List<GlobalAreaModel>> getArea(String gaParentCode) {
        List<GlobalAreaModel> globalAreaModels = globalAreaMapper.selectByParentCode(gaParentCode);
        return ServerResponse.createBySuccess(globalAreaModels);
    }

}
